﻿using System;
using System.ServiceModel;

namespace ConsoleApp.ReportsServiceReference
{
    public partial class ReportsServiceClient : IDisposable
    {
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        void IDisposable.Dispose()
        {
            var success = false;
            try
            {
                if (State != CommunicationState.Faulted)
                {
                    Close();
                    success = true;
                }
            }
            finally
            {

                if (!success)
                {
                    Abort();
                }
            }
        }
    }
}